package com.cma.cmabackend.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

@Configuration
public class WebConfig extends WebMvcConfigurationSupport {
    static final String FILE_PATH = System.getProperty("user.dir") + "/resources/files/";
    static final String EXCEL_PATH = System.getProperty("user.dir") + "/resources/excels/";

    static final String EXAMPLE_PATH = System.getProperty("user.dir") + "/resources/example/";

    @Override
    protected void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/files/**").addResourceLocations("file:" + FILE_PATH);
        registry.addResourceHandler("/excels/**").addResourceLocations("file:" + EXCEL_PATH);
        registry.addResourceHandler("/examples/**").addResourceLocations("file:" + EXAMPLE_PATH);
        super.addResourceHandlers(registry);
    }
}
